package com.caine.androidtask.ls13;

import com.caine.androidtask.launcher.Utils;

import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class FilterBroadcastReceiver extends BroadcastReceiver {
	public static final String START_RECEIVER = "com.caine.androidtask.START_RECEIVER";
	public static final String STOP_RECEIVER = "com.caine.androidtask.STOP_RECEIVER";

	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub
		Intent backServices = new Intent();
		ComponentName component = new ComponentName("com.caine.androidtask",
				"com.caine.androidtask.ls13.BackServer");
		backServices.setComponent(component);
		if(Utils.DEBUG)
			Log.e(Utils.TAG, "FilterBroadcastReceiver filter action ====== "+intent.getAction());
		if (intent.getAction().equals(START_RECEIVER)) {
			if(Utils.DEBUG)
				Log.e(Utils.TAG, "FilterBroadcastReceiver startService ");
			context.startService(backServices);
		} else {
			if(Utils.DEBUG)
				Log.e(Utils.TAG, "FilterBroadcastReceiver stopService ");
			context.stopService(backServices);
		}
	}

}
